home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / console-setup < prev    next >
Encoding:
Text File  |  2007-04-10  |  1.6 KB  |  72 lines

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          console-screen
  4. # Required-Start:    $local_fs $remote_fs
  5. # Default-Start:     S
  6. # Short-Description: Set console font and keymap
  7. ### END INIT INFO
  8.  
  9. set -e
  10.  
  11. test -f /bin/setupcon || exit 0
  12.  
  13. if [ -f /lib/lsb/init-functions ]; then
  14.     . /lib/lsb/init-functions
  15. else
  16.     log_action_begin_msg () {
  17.     echo -n "$@... "
  18.     }
  19.  
  20.     log_action_end_msg () {
  21.     if [ "$1" -eq 0 ]; then 
  22.         echo done.
  23.     else
  24.         echo failed.
  25.     fi
  26.     }
  27. fi
  28.  
  29. # Are we running from init?
  30. run_by_init()
  31. {
  32.     ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
  33. }
  34.  
  35. case "$1" in
  36.     stop)
  37.         # console-setup isn't a daemon
  38.         ;;
  39.     start|force-reload|restart|reload)
  40.     if expr "$(fgconsole 2>/dev/null || true)" : '[1-6]$' >/dev/null && \
  41.        ! pidof usplash >/dev/null; then
  42.         log_action_begin_msg "Setting up console font and keymap"
  43.         # Only use --save if we aren't in the boot sequence, to avoid
  44.         # slowing down the boot too much. Outside the boot sequence,
  45.         # this means that 'dpkg-reconfigure console-setup' automatically
  46.         # saves the font and keymap.
  47.         if run_by_init; then
  48.         save=
  49.         else
  50.         save=--save
  51.         fi
  52.         if setupcon --force $save; then
  53.         log_action_end_msg 0
  54.         else
  55.         log_action_end_msg $?
  56.         fi
  57.     elif ! run_by_init; then
  58.         log_action_begin_msg "Saving console font and keymap for next boot"
  59.         if setupcon --save-only; then
  60.         log_action_end_msg 0
  61.         else
  62.         log_action_end_msg $?
  63.         fi
  64.     fi
  65.     ;;
  66.     *)
  67.         echo 'Usage: /etc/init.d/console-setup {start|reload|restart|force-reload|stop}'
  68.         exit 1
  69.         ;;
  70. esac
  71.  
  72.